<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>RegExp对象</title>
    <script>
        /*
            2.正则对象:
					1.创建
						1.var reg = new RegExp("正则表达式");
						2.var reg = /正则表达式/;
					2.方法
						1.test(参数): 验证指定的字符串是否符合正则定义的规范
         */
        var reg = new RegExp("\w{6,12}");
        var reg2 = /^\w{6,12}$/;
        alert(reg);
        alert(reg2);

        var username = "zhangsansdfasdfsadfas";
        var flag = reg2.test(username);
        alert(flag);
    </script>
</head>
<body>

</body>
</html>